package br.ufmg.ubicomp.utils;


import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

public class XmlElement {
	private String name;
	private String kind;
	private Map<String, String> attributes;
	private Collection<XmlElement> elements;
	private String data;
	
	public XmlElement()
	{
		attributes = new HashMap<String, String>();
		elements = new ArrayList<XmlElement>();
	}
	
	@Override
	public String toString() {
		StringBuilder sb = new StringBuilder();
		sb.append(name + ": attributes = [");
		
		for (String key: attributes.keySet())
		{
			sb.append(key + "=\"" + attributes.get(key) + "\" ");			
		}
		sb.append("] ").append(" data = ").append(data);
		return sb.toString();
	}
	
	
	
	public String getKind() {
		return kind;
	}

	public void setKind(String kind) {
		this.kind = kind;
	}

	public void addAttribute(String key, String value)
	{
		attributes.put(key, value);
	}
	
	public Map<String, String> getAttributes()
	{
		return attributes;
	}

	public String getData() {
		return data;
	}

	public void setData(String data) {
		this.data = data;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
	
	
}
